#ifndef _OBJECT_H
#define _OBJECT_H

#include <stdint.h>

#include "queue.h"

struct object_t;

#define MAX_OBJECT_NAME_SIZE 256

struct object_t {
	LIST_ENTRY(object_t) entries; 
	unsigned int id;
	char name[MAX_OBJECT_NAME_SIZE];
};

#define o_name obj.name
#define o_id obj.id

LIST_HEAD(object_list_t, object_t);

typedef void process_obj_t(struct mg_connection *, void *);

/* return number of found objects */
extern int query_object(struct mg_connection *conn,
		const struct mg_request_info *ri,
		const char *uri,
		int mobile,
		struct object_list_t *list,
		process_obj_t proc);

#endif
